package com.igeekhome.ccs.controller;

import com.igeekhome.ccs.biz.ICommonWordsBiz;
import com.igeekhome.ccs.entity.CommonWords;
import com.igeekhome.ccs.entity.CustomerService;
import com.igeekhome.ccs.entity.CustomerServiceGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/cm")
public class CommonWordsController {
//👇zyh---------------------------------------------------------------
    @Autowired
    ICommonWordsBiz biz;

    //用户输入字符串模糊公共库常用语
    @GetMapping("/queryPublicCmByString")
    public @ResponseBody
    List<CommonWords> queryPublicCmByString(@RequestParam("str") String str) {
        return biz.matchPublicCmWithString(str);
    }

    //用户输入字符串模糊个人库常用语
    @GetMapping("/queryPrivateCmByString")
    public @ResponseBody
    List<CommonWords> queryPublicCmByString(@RequestParam("str")String str,@RequestParam("csId")int csId) {
        return biz.matchPrivateCmWithString(str,csId);
    }


    //通过常用语id拿到对应分类名
    @GetMapping("/queryCategoryNameByCmId")
    public @ResponseBody
    String queryCategoryNameByCmId(@RequestParam("cmId") int cmId) {return biz.queryCategoryNameByCmId(cmId);}

    //添加常用语
    @PostMapping("/createCw")
    public @ResponseBody
    int createCw(@RequestBody  CommonWords commonWords){
      biz.createCw(commonWords);
      return 0;
    }



//👆zyh-----------------------------------------------------------------
}


